﻿'Imports System.Data.SqlClient
Imports MySql.Data
Imports MySql.Data.MySqlClient


Public Class FormAddEmployee





    Private Sub EmployeeBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.EmployeeBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.HrisDataSet)

    End Sub

    Private Sub FormAddEmployee_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'HrisDataSet.employee' table. You can move, or remove it, as needed.
        'Me.EmployeeTableAdapter.Fill(Me.HrisDataSet.employee)

    End Sub


    Private Sub ButtonAddEmployeeCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddEmployeeCancel.Click
        Me.Dispose()
    End Sub

    Private Sub ButtonAddEmployeeOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddEmployeeOK.Click

        Try
            TableAdapterManager.employeeTableAdapter.AddFullName(TextBoxLastName.Text, TextBoxFirstName.Text, TextBoxMiddleName.Text)
            MessageBox.Show("Successfully added: " + TextBoxLastName.Text + ", " + TextBoxFirstName.Text + " into Employees")
        Catch ex As MySqlException
            MessageBox.Show("Error saving data.  " + ControlChars.CrLf + ex.Message)
            'MessageBox.Show("Unable to Connect to server.  Please ask the system administrator to configure the application's settings.")


        End Try

    End Sub


End Class